<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <%@include file="../../../resources/inc/head.jsp" %>
    <style>
        .layui-elem-quote {
            padding: 4px 15px;
        }

        .tableBlock {
            margin: 20px auto;
        }

        .tableBlock table {
            width: 100%;
            text-align: center;
            border-collapse: collapse;
            line-height: 36px;
        }

        .tableBlock table th {
            text-align: right;
            padding-right: 12px;
            font-weight: normal;
            color: #1a1a1a;
            white-space: nowrap;
        }

        .tableBlock table td, .tableBlock table th {
            border: 1px solid #e6e6e6;
            font-size: 14px;
        }

        .layui-input, .layui-select, .layui-textarea {
            border: none;
        }

        .upload-div li {
            display: inline-block;
            width: 120px;
            margin-right: 20px;
            vertical-align: top;
            text-align: center;
        }

        .upload-div li .upload-item {
            width: 100%;
            height: 180px;
            text-align: center;
            border: 1px solid #e6e6e6;
            position: relative;
        }

        .layui-input-inline {
            overflow: hidden;
            height: 180px;
            width: 120px
        }

        .layui-upload-drag {
            border: none;
        }
    </style>
</head>

<div class="layui-fluid" style="min-width: 1150px">

    <div class="layui-card">

        <div class="layui-card-body">
            <%--<form class="layui-form" action="">--%>
            <c:if test="${!sessionScope.oauthData.isAuth}">
                <c:if test="${sessionScope.oauthData.status==-1}">
                    <a lay-href="<%=basePath%>manager/merchant/certification.html" style="color: red">
                        还未认证，去认证!
                    </a>
                </c:if>
                <c:if test="${sessionScope.oauthData.status==0}">
                    <a href="javascript:;" style="color: red">
                        认证中...
                    </a>
                </c:if>
                <c:if test="${sessionScope.oauthData.status==3}">
                    <a href="javascript:;" style="color: red">
                        认证失败...
                    </a>
                </c:if>
            </c:if>
            <c:if test="${sessionScope.oauthData.isAuth}">
                <div class="tableBlock">
                    <blockquote class="layui-elem-quote">基础信息</blockquote>
                    <table>
                        <tbody>
                        <tr>
                            <th>手机号：</th>
                            <td>
                                <p style="width: 200px">${merchantUser.mobile}</p>
                            </td>
                            <th>邮箱号：</th>
                            <td>
                                <p style="width: 200px">${merchantUser.email}</p>
                            </td>
                            <th>公司名：</th>
                            <td>
                                <p style="width: 200px">${merchantUser.company}</p>
                            </td>
                            <td>
                                <div class="site-demo-button" id="privateKey" style="margin-bottom: 0;">
                                    <button data-method="checkprivateKey"
                                            class="layui-btn layui-btn-normal layui-btn-xs">
                                        查看秘钥
                                    </button>
                                    <button data-method="resetprivateKey"
                                            class="layui-btn layui-btn-danger layui-btn-xs">
                                        重置秘钥
                                    </button>
                                </div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div>

                    <table id="merchatCentreManger" lay-filter="merchantApplicationManage">
                    </table>
                </div>

                <script>
                    //Demo
                    layui.use('form', function () {
                        var form = layui.form;
                        //监听提交
                        form.on('submit(formDemo)', function (data) {
                            layer.msg(JSON.stringify(data.field));
                            return false;
                        });
                    });
                </script>
            </c:if>
        </div>
    </div>
</div>

<%@include file="../../../resources/inc/footer.jsp" %>
<script>
    layui.config({
        base: '<%=basePath%>resources/lib/layuiAdmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table', 'laydate'], function () {
        var $ = layui.$
            , form = layui.form
            , table = layui.table;
        var laydate = layui.laydate;
        table.render({
            elem: '#merchatCentreManger',
            url: '<%=basePath%>merchantUser/getPaymentChannels.html',
            cols: [[
                {type: 'checkbox', fixed: 'left'},
                {field: 'id', width: 50, title: 'ID', sort: true}
                , {field: 'name', title: '支付渠道'}
                , {field: 'rate', title: '费率'}
                , {field: 'settlementCycle', title: '结算周期'}
            ]],
            height: "full-130",
            text: {none: "暂无可显示数据"},
            response: {
                statusCode: 200
            }
        });
        laydate.render({
            elem: '#business_license_validity' //指定元素
        });
        laydate.render({
            elem: '#legal_person_ID_validity' //指定元素
        });
        var active = {
            checkprivateKey: function () {
                var privateKey = "${merchantUser.privateKey}"
                if (privateKey == '') {
                    layer.confirm('秘钥未设置,是否现在设置?', {
                        title: "提示",
                        btn: ['立即设置', '暂不设置'],

                    }, function () {
                        var dialog = new UtilClass.LayerDialog({
                            title: "设置秘钥",
                            content: "<%=basePath%>merchantUser/setPrivateKey.html"
                        });
                        layer.close(layer.index)
                        dialog.layerShow();
                    });
                } else {
                    layer.confirm('', {
                        title: "秘钥信息",
                        btn: ['确定'],
                        content: "${merchantUser.privateKey}"
                    });
                }

            },
            resetprivateKey: function () {
                var dialog = new UtilClass.LayerDialog({
                    title: "设置秘钥",
                    content: "<%=basePath%>merchantUser/setPrivateKey.html"
                });
                dialog.layerShow();
            }
        }
        $('#privateKey .layui-btn').on('click', function () {
            var othis = $(this), method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });

    });
</script>
</body>
</html>

